package com.study.suanfa;

import java.util.Arrays;

/**
 * @description: recursiveTest   递归
 * @date: 2020/11/12 20:58
 * @author: hcm
 * @version: 1.0
 */
public class recursiveTest {
    public static void main(String[] args) {
        maze();
    }

    //迷宫问题

    private static void maze(){

        //创建迷宫地图数组,7行8列
        int[][] map = new int[8][7];
        //创建围墙，上下全部为1
        for (int i = 0; i < 7; i++) {
            map[0][i] = 1;
            map[7][i] = 1;
        }

//        //创建围墙，左右全部为1
        for (int j = 0; j < 8; j++) {
            map[j][0] = 1;
            map[j][6] = 1;
        }

        //设置挡板
        map[3][1] = 1;
        map[3][2] = 1;

        //输出地图 ----》外循环加内循环
        for (int i = 0; i < 8; i++) {
            for (int i1 = 0; i1 < 7; i1++) {
                System.out.print(map[i][i1]+" ");
            }
            System.out.println();
        }
        //递归回溯小球寻路

    }






    //简单案例理解递归
    private static void test1(int n) {

        //递归打印0-n
        if(n>=0){
            System.out.println(n);
            test1(n-1);
            System.out.println(n);
        }

    }



}
